package nl.hr.cmi.project4.inf1m.groep1.ZuinigRijden;

import android.location.Location;
import android.text.format.Time;

public class SmallLocation {
	
	private double longitude;
	private double latitude;
	private double altitude;
	private long time;
	private float speed;
	
	public SmallLocation(){
		longitude = 0.0;
		latitude = 0.0;
		altitude = 0.0;
		time = 0;
		speed = 0;
	}
	
	public SmallLocation(Location location){
		longitude = location.getLongitude();
		latitude = location.getLatitude();
		if(location.hasAltitude()){
			altitude = location.getAltitude();
		}
		time = location.getTime();
		speed = location.getSpeed();
	}
	
	public SmallLocation(Location location, boolean useTimeFromLocation){
		longitude = location.getLongitude();
		latitude = location.getLatitude();
		if(location.hasAltitude()){
			altitude = location.getAltitude();
		}
		speed = location.getSpeed();
		if(useTimeFromLocation){
			time = location.getTime();
		} else {
			time = System.currentTimeMillis();
		}
	}//
	
	public void setLocation(Location location){
		longitude = location.getLongitude();
		latitude = location.getLatitude();
		if(location.hasAltitude()){
			altitude = location.getAltitude();
		}
		time = location.getTime();
		speed = location.getSpeed();
	}
	
	public double getLongitude(){
		return longitude;
	}
	public void setLongitude(double d){
		longitude = d;
	}
	public double getLatitude(){
		return latitude;
	}
	public void setLatitude(double d){
		latitude = d;
	}
	public double getAltitude(){
		return altitude;
	}
	public void setAltitude(double d){
		altitude = d;
	}
	public long getTime(){
		return time;
	}
	public void setTime(long l){
		time = l;
	}
	public void setTime(Time t){
		time = t.toMillis(false);
	}
	public float getSpeed(){
		return speed;
	}
	public void setSpeed(float f){
		speed = f;
	}
}
